import MyTable from '@/components/MyTable';
import RoleEdit from '@/pages/System/components/editRole';
import TableRole from '@/pages/System/components/tableRole';
import { roleFindByPageList } from '@/services/sys/RoleService';
import { ProColumns } from '@ant-design/pro-components';
import React from 'react';

const PageView: React.FC = () => {
  const columns: ProColumns<API.MenuTreeInfo>[] = [
    {
      title: '标题',
      dataIndex: 'name',
    },
    {
      title: '备注',
      dataIndex: 'description',
    },
    {
      title: '操作',
      valueType: 'option',
      key: 'option',
      render: (text, record, _, action) => [
        <RoleEdit text={'编辑'} row={record} />,
        <TableRole text={'分配权限'} row={record} />,
      ],
    },
  ];
  const toolbar = () => [<RoleEdit text={'新增角色'} isCard={true} />];
  return (
    <MyTable toolbar={toolbar} columns={columns} request={roleFindByPageList} />
  );
};
export default PageView;
